package com.ruitu.ssmic.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ruitu.arad.base.BaseFragment;
import com.ruitu.arad.util.ToastUtils;
import com.ruitu.ssmic.R;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;

public class LifeFragment extends BaseFragment {
    private RelativeLayout rl_menu1, rl_menu2, rl_menu3, rl_menu4, rl_menu5, rl_menu6;

    public static LifeFragment newInstance() {

        Bundle args = new Bundle();

        LifeFragment fragment = new LifeFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_life, container, false);

        rl_menu1 = v.findViewById(R.id.rl_menu1);
        rl_menu2 = v.findViewById(R.id.rl_menu2);
        rl_menu3 = v.findViewById(R.id.rl_menu3);
        rl_menu4 = v.findViewById(R.id.rl_menu4);
        rl_menu5 = v.findViewById(R.id.rl_menu5);
        rl_menu6 = v.findViewById(R.id.rl_menu6);

        ((TextView) v.findViewById(R.id.tv_title)).setText("生活服务");
        ((Toolbar) v.findViewById(R.id.toolbar)).setNavigationIcon(null);

        setListeners();

        return v;
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        if (v == rl_menu1) {
            ToastUtils.showShortSafe("智能家居");
        }
        if (v == rl_menu2) {
            ToastUtils.showShortSafe("生活缴费");
        }
        if (v == rl_menu3) {
            ToastUtils.showShortSafe("服务");
        }
        if (v == rl_menu4) {
            ToastUtils.showShortSafe("大家说");
        }
        if (v == rl_menu5) {
            ToastUtils.showShortSafe("监控");
        }
        if (v == rl_menu6) {
            ToastUtils.showShortSafe("健康");
        }
    }

    private void setListeners() {
        rl_menu1.setOnClickListener(this);
        rl_menu2.setOnClickListener(this);
        rl_menu3.setOnClickListener(this);
        rl_menu4.setOnClickListener(this);
        rl_menu5.setOnClickListener(this);
        rl_menu6.setOnClickListener(this);
    }


}
